package com.ssl.tensquare.recruit.controller;

import com.ssl.tensquare.common.entity.RecruitState;
import com.ssl.tensquare.common.entity.Result;
import com.ssl.tensquare.common.entity.StatusCode;
import com.ssl.tensquare.recruit.pojo.Recruit;
import com.ssl.tensquare.recruit.service.RecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 描述：
 *
 * @author ssl
 * @create 2019/07/08 13:57
 */
@RequestMapping("recruit")
@RestController
public class RecruitController {
    @Autowired
    private RecruitService recruitService;

    /**
     * 查询推荐职位
     *
     * @return
     */
    @GetMapping("search/recommend")
    public Result recommend() {
        List<Recruit> list = recruitService.findTop4ByStateOrderByCreateTimeDesc(RecruitState.recommend.name());
        return new Result(true, StatusCode.OK, "查询成功", list);
    }

    /**
     * 查询最新职位
     *
     * @return
     */
    @GetMapping("search/newlist")
    public Result newList() {
        List<Recruit> list = recruitService.newList();
        return new Result(true, StatusCode.OK, "查询成功", list);
    }
}
